/**
 * PlayerSelf.java
 *
 * @author Beatrice Bacelli
 * @author Luca Bedogni
 * @author Silvia Righini
 */
package unibo.lsb.logic;

import java.io.Serializable;

public class PlayerSelf extends PlayerId implements Serializable {

	int indexInTable = -1;

	/**
	 * Constructor
	 * 
	 * @param p
	 */
	public PlayerSelf(PlayerId p) {
		super(p.getName(), p.getPassword(), p.getIpAddress(), p.getPort(), p
				.getIconNumber());
	}

	/**
	 * Sets the turn.
	 * 
	 * @param n
	 */
	public void setIndexInTable(int n) {
		indexInTable = n;
	}

	/**
	 * Returns the turn.
	 * 
	 * @return
	 */
	public int getIndexInTable() {
		return indexInTable;
	}

	/**
	 * Ad-hoc equals.
	 */
	@Override
	public boolean equals(PlayerId p) {
		boolean b = false;
		if ((this.getName().equals(p.getName()))
				&& (this.getIpAddress().equals(p.getIpAddress()))
				&& (this.getPassword().equals(p.getPassword()))
				&& (this.getPort() == (p.getPort()))
				&& (this.getIconNumber().equals(p.getIconNumber()))) {
			b = true;
		}
		return b;
	}
}
